<%--
    Document   : profilecomplet
    Created on : Jun 14, 2014, 12:16:02 PM
    Author     : Yogesh Paisode
--%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<html:html lang="true">

    <script type="text/javascript" src="commonfiles/js/CityState.js"></script>

<%
    

                  String firstName=(String)session.getAttribute("firstName");
                  String lastName=(String)session.getAttribute("lastName");
                  String id=(String)session.getAttribute("id");
                  String middelName=(String)session.getAttribute("middelName");
                  String address=(String)session.getAttribute("address");
                  String mobileNumber=(String)session.getAttribute("mobileNumber");
                  String emailId=(String)session.getAttribute("emailId");
                  String gender=(String)session.getAttribute("gender");
                  String dob=(String)session.getAttribute("dob");
                  String password=(String)session.getAttribute("password");
                  String city=(String)session.getAttribute("city");
                  String CountryState=(String)session.getAttribute("CountryState");
                  String pinCode=(String)session.getAttribute("pinCode");
                  String contry=(String)session.getAttribute("contry");
                  String profPic=(String)session.getAttribute("profPic");
                  String activationCode=(String)session.getAttribute("activationCode");
                  String profileState=(String)session.getAttribute("profileState");
                  String profileStatus=(String)session.getAttribute("profileStatus");
                  String profileCompletion=(String)session.getAttribute("profileCompletion");

                     String format="";
        if(firstName!=null){

                      
                        String temp=firstName+lastName;

                        if(temp.length()<15){
                                format= " "+firstName+" "+lastName;
                            }
                        else{
                                format=" "+firstName+" ";
                            }


                    }

                  String data="";


                    java.io.BufferedReader br = null;

                                        try {

                                        String sCurrentLine;

                                        br = new java.io.BufferedReader(new java.io.FileReader(""+profPic+""));
                                        profPic="";

                                        while ((sCurrentLine = br.readLine()) != null) {
                                                profPic=profPic+sCurrentLine;
                                        }

                                        } catch (Exception e) {
                                                e.printStackTrace();
                                        }





       if(firstName==null){

                    data="<li><a href=\"login.jsp\">Login</a></li> <li><a href=\"register.jsp\">Sign Up</a></li></ul></nav></div></div>";


                    profileState="";
                    profileCompletion="";
                    profileStatus="";

                    firstName="hhhhhhhhhjjjjjjjjjhhhhhhhhhhhhhhhhh";
                    lastName="hhhhjjjjjjjjjjjjjhhhhhhhhhhhhhhhhhh";
                    middelName="hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh";
                    id="";
                    address="";
                    mobileNumber="";
                    emailId="";
                    gender="";
                    dob="";
                    password="";
                    city="";
                    CountryState="";
                    pinCode="";
                    contry="";
                    profPic="";
                    activationCode="";


           }
       else{
                    data="<li><a href=\"profile.jsp\">"+format+"<br> Profile</a></li><li><a href=\"Logout.jsp\">Logout</a></li></ul></nav></div></div>";
                    out.print("<title>"+firstName.substring(0,1).toUpperCase()+firstName.substring(1)+" "+lastName.substring(0,1).toUpperCase()+lastName.substring(1)+"-Edit</title>");

           }


%>

<jsp:include page="header.jsp"/>

<%
    out.print(data);
%>

<%

        String copyfirstName=(String)session.getAttribute("copyfirstName");
        String copylastName=(String)session.getAttribute("copylastName");
        String message="";

        if(copyfirstName==null){
                message="User ";
                session.setAttribute("message","ProfileCompletion");
                String  url[]=request.getRequestURI().split("/");
                String pageRedir=url[2];
                session.setAttribute("pageRedir",pageRedir);
                response.sendRedirect("login.jsp");

            }
        else{
                message=copyfirstName.substring(0,1).toUpperCase()+copyfirstName.substring(1);
            }

%>



<div style="position:relative;width: auto;z-index: 10000;">
    <div id="cssmenu" style="background-color: black;">
     <section class="innerpages">
         <div class="grid_12" style="background-image: url('commonfiles/images/satyapal.jpg'); width:100%;">
             <h1><%
             out.print(message);
            %> Complete Your Profile..</h1>
         </div>
     </section>
</div>
</div>


<div class="block2">
  <div class="container_12">
    <!--==============================content================================-->
    <section class="content">
      <div class="wrapper projects">
        <div class="row clearfix">
          <article class="grid_18">
            <div class="post">
                <br><br>
                <img src="https://lh5.googleusercontent.com/-iSVw94VnNc4/T9kJ016IDtI/AAAAAAAAAFg/SgB8UGlyjtM/s630/Color%2BDroplets.JPG" alt="Post" style="width: 913;height: 347; border-style: double; border: blue; border-bottom-style: double;">

              <a href="#">  <img src="<%

                                out.print(profPic);

                    %>" alt="Post" style=" margin:-153px 100 30 22; width:153;height:163; border: blue; border-bottom-style: double;"></a>
              <h1 style="font-size:x-large; color: blue; z-index: 100000; margin: -334 14 23 420; position: absolute;"><%

                                 out.print(firstName.substring(0,1).toUpperCase()+firstName.substring(1)+" "+lastName.substring(0,1).toUpperCase()+lastName.substring(1));

                    %></h1>



<div class="dock" style="margin:-125px -28 150 71;">
   <ul>
    <li><a href="ProfileCompletion.jsp"><img src="commonfiles/images/My-Profile.png" alt="Home"></a></li>
    <li><a href="MyPostedAd.jsp"><img src="commonfiles/images/My-Advertisement.png" alt="Apple"></a></li>
    <li><a href="MyInsurance.jsp"><img src="commonfiles/images/My-Insurance.png" alt="Safari"></a></li>
    <li><a href=""><img src="commonfiles/images/My-Tender.png" alt="harddrive"></a></li>
  </ul>


</div>


</div>

                    <script>
                        <%
                                out.print("var name='"+firstName.substring(0,1).toUpperCase()+firstName.substring(1)+"'");
                        %>

                    </script>



              <div class="hireus_block" style="padding-left: 136px;">
    <div class="container_12" style="width:1267px;">
        <div class="ui-widget"style="padding-left: 42px; width: 650px;">
              <div class="ui-state-blue ui-corner-all">
                <p><strong>Complete Profile</strong></p>
              </div>
            </div>
    <section class="">
      <div class="wrapper">

        <article class="grid_9">

            <div id="cform" name="cform" class="clearfix">

                <html:form action="/ProfileCompletion">

                <input type="text" hidden="" name="id"  value="<%
                                    out.print(id);

                        %>"/>

                 <input type="text" hidden="" name="activationCode"  value="<%
                                    out.print(activationCode);

                        %>"/>


            <ul id="homehireus" class="hireform">
                <li type="none">
                <label> First Name:<span class="required">*</span></label>
                <input name="firstName" id="name" type="text" value="<%out.print(firstName);%>" tabindex="2" style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>
              <li type="none">
                <label> Middle Name:<span class="required">*</span></label>
                <input name="middelName" id="name" type="text" value="<%
                                    out.print(middelName);

                        %>" tabindex="1" style="padding: 0px 10px 0px 126px; width: 277px; height: 33px;">
              </li>
              <li type="none">
                <label> Last Name:<span class="required">*</span></label>
                <input name="lastName" id="name" type="text" value="<%
                                    out.print(lastName);

                        %>" tabindex="1" style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>
              <li type="none">
                <label>Email:</label>
                <input name="emailId" id="phone" type="text" value="<%
                                    out.print(emailId);

                        %>" tabindex="3" style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>
              <li type="none">
                <label>Mobile:<span class="required">*</span></label>
                <input name="mobileNumber" id="email" type="text" value="<%
                                    out.print(mobileNumber);

                        %>" tabindex="2"style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>

             

             
              

              <li type="none">
                <label>Phone:</label>
                <input name="phone" id="email" type="text" value="0712-" tabindex="2"style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>

              <li type="none">
                <label>Address:<span class="required">*</span></label>
                <input name="address" id="email" type="text" value="<%
                                    out.print(address);

                        %>" tabindex="2"style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>

              <li type="none">
                <label>Pin code:<span class="required">*</span></label>
                <input name="pinCode" id="email" type="text" value="<%
                                    out.print(pinCode);

                        %>" tabindex="2"style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>

              <li type="none">
                <label>Date Of Birth:<span class="required">*</span></label>
                <input name="dob" id="email" type="date" type="text" value="<%
                                    out.print(dob);

                        %>" tabindex="2"style="padding: 0px 10px 0px 116px; width: 277px; height: 33px; border-style: none;">
              </li>

              <li type="none">
                <label>Old Password:</label>
                <input name="password" id="email" type="text" value="<%
                                    out.print(password);

                        %>" tabindex="2"style="padding: 0px 10px 0px 118px; width: 277px; height: 33px;">
              </li>

              <li type="none">
                <label>New Password:</label>
                <input name="password" id="email" type="text" value="" tabindex="2"style="padding: 0px 10px 0px 122px; width: 277px; height: 33px;">
              </li>

              <li type="none">
                   <label>Confirm New Password:</label>
                  <input name="password1" id="email" type="text" value="" tabindex="2"style="padding: 0px 10px 0px 122px; width: 277px; height: 33px;">
              
              </li>
           

                Region&raquo; <select onchange="set_country(this,country,city_state)" size="1" name="region">
<option value="" selected="selected"><%

       

           out.print("SELECT REGION");

          

%></option>
<option value=""></option>
<script type="text/javascript">
setRegions(this);
</script>
</select>
Country&raquo; <select name="country" size="1"  onchange="set_city_state(this,city_state)"><option><%
                                    out.print(contry);

                        %></option></select>
State&raquo; <select name="city_state" size="1"  onchange="print_city_state(country,this)"><option><%
                                    out.print(CountryState);

                        %></option></select>


                        <br><br>

                       <li type="none">
                <label>City:<span class="required">*</span></label>
                <input name="city" id="email" type="text" value="<%
                                    out.print(city);

                        %>" tabindex="2"style="padding: 0px 10px 0px 100px; width: 277px; height: 33px;">
              </li>

                        <br><br><br><br>

                        <div style="display: block; border: dotted 1px;">
                            <h1>Upload Profile Picture</h1><br>
                        <div id="files"><input type="file"  id="img" multiple accept="image/*" /></div>

                        <br><h1> Or</h1>
                        <p>Upload Image From Image URL:<br>
                        Just Past Image URL In The Following TextBox<br><br>Use CTR+V To past Link Or Use Mouse And Then Press ENTER</p>
                        <li type="none">
                        
                            <textarea type="text" id="onlinePic" style=" width: 657px; height: 33px;" onkeyup="onlineImage()" onclick="onlineImage()" onchange="onlineImage()" >
                         </textarea>
                    </li><br><br><br>
                    <li type="none">
                        <h1>Your Image Will Look Like These</h1>
                    </li>
        <script>


  function handleFileSelect(evt) {

    var files = evt.target.files; // FileList object

	//	hello();
    for (var i = 0, f; f = files[i]; i++) {



      var reader = new FileReader();

      reader.onload = (function(theFile) {
        return function(e) {

	im = new Image();


            

       var width, height;
im.onload = function() {
  width = this.width;
  height = this.height;

       // alert(width+" "+height);

 // if(width<=350&&height<=451&&s.length&&s.length<=39211){
      var s1="<input type='password' name=\"profPic\" readonly value='"+s+"' hidden=\"\"/>";
	outputdiv = document.getElementById('p');
	outputdiv.innerHTML = s1;

       var s2="<img src='"+s+"' width=100 height=150/>";
        outputdiv = document.getElementById('pic');
	outputdiv.innerHTML = s2;

        var s3="<img src='"+s+"'/>";
        outputdiv = document.getElementById('pic1');
	outputdiv.innerHTML = s3;
 /* }
  else{
      alert(name+" Your Selected Image Is Too Large To Upload !");
  }*/

        
};



        im.src = e.target.result;
	var s=im.src;
	//alert(s);


       


	    };
      })(f);
      reader.readAsDataURL(f);
    }
  }

  document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script>


<script>
function onlineImage() {
    var x = document.getElementById("onlinePic").value;


    


    var image = new Image();
var width, height;
image.onload = function() {
  width = this.width;
  height = this.height;

  //if(width<=350&&height<=451){

       var s1="<input type='password' name=\"profPic\" readonly value='"+x+"' hidden=\"\"/>";
	outputdiv = document.getElementById('p');
	outputdiv.innerHTML = s1;

       var s2="<img src='"+x+"' width=100 height=150/>";
        outputdiv = document.getElementById('pic');
	outputdiv.innerHTML = s2;

        var s3="<img src='"+x+"'/>";
        outputdiv = document.getElementById('pic1');
	outputdiv.innerHTML = s3;

/*  }
  else{
         document.getElementById("onlinePic").value="";
       alert(name+" Your Selected Image Is Too Large To Upload !");

  }*/




};
image.src = x;


}
</script>



             <div id="pic"><img src=""/></div>

<div id="p"></div>

<div id="output">
              <input type="password" name="profPic" hidden=\"\" value="<%out.print(profPic);%>"/>
          </div>
                        </div>
 </ul>
             
<html:submit/>
          </html:form>

      </div>
          
        </article>
      </div>
    </section>
  </div>
</div>





               </article>

        </div>
      </div>
    </section>
  </div>
</div>
</div>



<script type="text/javascript" src="commonfiles/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="commonfiles/js/superfish.js"></script>

<script type="text/javascript" src="commonfiles/js/jquery.isotope.min.js"></script>
<script type="text/javascript" src="commonfiles/js/contact.js"></script>
<script type="text/javascript" src="commonfiles/js/jquery.carouFredSel-6.1.0-packed.js"></script>
<script type="text/javascript" src="commonfiles/js/touchTouch.jquery.js"></script>
<script type="text/javascript" src="commonfiles/js/jquery-ui-1.8.24.custom.min.js"></script>

<jsp:include page="footer.jsp"/>

</html:html>